Skip to content

Navigation Menu

Sign in
Sign up

add cancel_reason to RpcInvocationData - #809

Open
davidzhao wants to merge 1 commit into
main from
dz/rpc-cancellation-reason
Open

add cancel_reason to RpcInvocationData #809
davidzhao wants to merge 1 commit into
main from
dz/rpc-cancellation-reason

Conversation

@davidzhao

@davidzhao davidzhao commented Sep 9, 2026

Copy link
Copy Markdown
Member

in order to allow downstream interceptors/tracing to determine why the call was not successful.

in order to allow downstream interceptors/tracing to determine why the
call was not successful.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

# only a cancel the chain accepted counts: cancel() is False when the chain has
# already finished, which can happen in the same loop iteration the timer fires
# while this task has not resumed yet; that result is the caller's, not a timeout
invocation.cancel_reason = RpcError.ErrorCode.RESPONSE_TIMEOUT

@devin-ai-integration devin-ai-integration Bot Sep 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Concurrent disconnect records wrong reason

When a room disconnect races the response deadline, cancel_reason reports RESPONSE_TIMEOUT while the caller receives RECIPIENT_DISCONNECTED. The deadline cancels the chain before the outer task handles the disconnect and replaces the reason.

Prompt for agents
Resolve cancellation precedence in LocalParticipant._run_incoming_chain so RpcInvocationData.cancel_reason observed during interceptor unwinding always matches the RpcError returned to the caller. A deadline callback can currently cancel the chain and expose RESPONSE_TIMEOUT before concurrent cancellation of the outer invocation enters the disconnect branch, which later returns RECIPIENT_DISCONNECTED. Add a deterministic race test covering both events in the same loop turn and coordinate the selected outcome before exposing the reason to the chain.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@devin-ai-integration devin-ai-integration[bot] devin-ai-integration[bot] left review comments
@cloudwebrtc cloudwebrtc cloudwebrtc approved these changes
@lukasIO lukasIO Awaiting requested review from lukasIO lukasIO is a code owner
@xianshijing-lk xianshijing-lk Awaiting requested review from xianshijing-lk xianshijing-lk is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /